package dli_and_obs

import java.io.FileInputStream
import java.util.Properties


/**
  * @Description
  * @Author liutaowei
  * @Date 2019-5-22 14:58
  */
object dli_job {
  def main(args: Array[String]): Unit = {
    val properties = new Properties()
    properties.load(new FileInputStream("src\\main\\scala\\dli_and_obs\\dli.properties"))
    val result = job_style_choice(properties) // 任务类型判断
  }


  def job_style_choice(properties: Properties) = {
    val job_style = properties.getProperty("job_style").trim
    var result = ""
    if (job_style.equals("jarloadandrun")) {
      //    val check_cluster = utils.cluster_utils.check_dli_cluster(dli_client,properties) // 检查是否创建队列
      result = job_utils.dli_jar_loadAndRun.jar_load_and_run(properties)
    } else if (job_style.equals("dli_jobrun")) {
      //    val check_cluster = utils.cluster_utils.check_dli_cluster(dli_client,properties) // 检查是否创建队列
      result = job_utils.dli_job_run.DLI_job(properties)
    } else if (job_style.equals("dli_jobstate")) {
      println("获取任务状态")
      result = job_utils.dli_job_state.DLI_jobstate(properties)
    } else if (job_style.equals("dli_getlog")) {
      println("获取日志")
      result = job_utils.dli_job_log.DLI_joblog(properties)
    }
    result
  }

}
